package main

import (
	"go_code/emojidealer/logic"
	"runtime"
	"sync"
)

var cpus = runtime.NumCPU()
var wg sync.WaitGroup

func main() {
	//程序生效目录
	//例：path := "C:\\Users\\Desktop\\photo"
	fileChan := make(chan string, 50)
	path := "./"

	wg.Add(1)
	go func() {
		defer wg.Done()
		logic.ReadFiles(path, fileChan)
	}()

	for i := 0; i < cpus-2; i++ {
		wg.Add(1)
		go func() {
			defer wg.Done()
			logic.ChangeFiles(path, fileChan)
		}()
	}
	wg.Wait()
	close(fileChan)
}
